package loggerhelper
Import Path
github.com/Golang-Tools/loggerhelper (on go.dev)
Dependency Relation
imports 4 packages, and imported by one package
Package-Level Type Names (total 5, in which 4 are exported)
Dict 简化键值对的写法
redis类型
const FormatType_JSON
const FormatType_Text
Option configures how we set up the connection.
( T) Apply(*Options)
*funcOption
func AddExtField(field string, value interface{}) Option
func AddHooks(hooks ...logrus.Hook) Option
func WithDefaultFieldMap(fm logrus.FieldMap) Option
func WithDisableTimeField() Option
func WithExtFields(extFields map[string]interface{}) Option
func WithLevel(loglevel string) Option
func WithOutput(writer io.Writer) Option
func WithTextFormat() Option
func WithTimeFormat(TimeFormat string) Option
func Init(opts ...Option)
Option 设置key行为的选项
@attribute MaxTTL time.Duration 为0则不设置过期
@attribute AutoRefresh string 需要为crontab格式的字符串,否则不会自动定时刷新
DefaultFieldMap logrus.FieldMap
DisableTimeField bool
ExtFields map[string]interface{}
Hooks []logrus.Hook
Level logrus.Level
Output io.Writer
TimeFormat string
Type FormatType
func Option.Apply(*Options)
var DefaultOpts
Package-Level Functions (total 20, in which 18 are exported)
AddExtField Init函数的参数,用于增加扩展字段
AddHooks Init函数的参数,用于增加钩子
Debug 默认log打印Debug级别信息
@params message string 事件消息
@params fields ...map[string]interface{} 信息字段
Error 默认log打印Error级别信息
@params message string 事件消息
@params fields ...map[string]interface{} 信息字段
Fatal 默认log打印Fatal级别信息
@params message string 事件消息
@params fields ...map[string]interface{} 信息字段
Info 默认log打印Info级别信息
@params message string 事件消息
@params fields ...map[string]interface{} 信息字段
Init 初始化默认的log对象
@params opts ...Option 初始化使用的参数,具体可以看options.go文件
New 初始化log的配置
Panic 默认log打印Panic级别信息
@params message string 事件消息
@params fields ...map[string]interface{} 信息字段
Trace 默认log打印Trace级别信息
@params message string 事件消息
@params fields ...map[string]interface{} 信息字段
Warn 默认log打印Warn级别信息
@params message string 事件消息
@params fields ...map[string]interface{} 信息字段
WithDefaultFieldMap Init函数的参数,用于设置默认字段的新命名
WithDisableTimeField Init函数的参数,用于设置使用text格式替换json格式
WithExtFields Init函数的参数,用于设置扩展字段
WithLevel Init函数的参数,用于设置log等级
WithOutput Init函数的参数,用于设置log的写入io
WithTextFormat Init函数的参数,用于设置使用text格式替换json格式
WithTimeFormat Init函数的参数,用于设置使用指定的时间解析格式,默认为RFC3339Nano
Package-Level Constants (total 2, both are exported)
const FormatType_JSON FormatType = 0 const FormatType_Text FormatType = 1![]() |
The pages are generated with Golds v0.3.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |